
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <div class="post">

        <h2 class="title">Cadastro de Cursos</h2>

        <h:panelGroup id="painelMensagens" layout="block">
            <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
        </h:panelGroup>

        <div id="stylized" class="myform">

            <h:form>

                <h:outputLabel>Nome do Curso<span class="small">Completo até 120 caraceres</span></h:outputLabel>
                <h:inputText  value="#{CursoController.curso.nome}" required="true" requiredMessage="Nome requerido." />

                <h:outputLabel>Sigla<span class="small">Max 10 caracteres</span></h:outputLabel>
                <h:inputText  value="#{CursoController.curso.sigla}" required="true" requiredMessage="Sigla requerida." />

                <h:outputLabel>Tipo de Curso<span class="small">Selecione uma opção</span></h:outputLabel>
                <h:selectOneMenu value="#{CursoController.curso.tipoCurso}" label="lalala">
                    <f:selectItems value="#{CursoController.tiposCurso}" />
                </h:selectOneMenu>


                
                <h:commandButton class="button" action="#{CursoController.persiste}" value="Salvar" />
                <h:commandButton class="button" type="reset" value="Limpar" />




            </h:form>
        </div>
    </div>
        <p>
        <h2 class="title">Cursos Cadastrados</h2>
        <br />
        <h:form id="form2">

                <p:dataTable var="curso" value="#{CursoController.cursos}" >
                    <p:column sortBy="#{curso.sigla}">
                        <f:facet name="header">
                            <h:outputText value="Sigla" />
                        </f:facet>
                        <h:outputText value="#{curso.sigla}" />
                    </p:column>

                    <p:column sortBy="#{curso.nome}">
                        <f:facet name="header">
                            <h:outputText value="Nome" />
                        </f:facet>
                        <h:outputText value="#{curso.nome}" />
                    </p:column>
                     <p:column>
                        <f:facet name="header">
                            <h:outputText value="Editar" />
                        </f:facet>
                         <h:commandLink action="#{CursoController.edit}">Edit</h:commandLink>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Remover" />
                        </f:facet>
                        <h:commandLink action="#{CursoController.destroy}" >Remove</h:commandLink>
                    </p:column>

                   
                </p:dataTable>
            </h:form>
        </p>
</html>
